package com.yuanli.cosmeticmirror.view.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yuanli.cosmeticmirror.R;
import com.yuanli.cosmeticmirror.base.MyApp;
import com.yuanli.cosmeticmirror.bean.FavoriteBean;

import comenjoy.com.imageloadlibrary.GlideUtil;

/**
 * 教程适配器
 */
public class FavoriteAdapter extends BaseQuickAdapter<FavoriteBean.DataBean, BaseViewHolder> {
    public FavoriteAdapter() {
        super(R.layout.items_favorite);
        addChildClickViewIds(R.id.favorite_more);
    }

    @Override
    protected void convert(BaseViewHolder helper, FavoriteBean.DataBean item) {
        GlideUtil.getInstance().loadImage(MyApp.getInstance(), item.getCovingimg(), R.drawable.tutorial_default_img, helper.getView(R.id.favorite_img));
        helper.setText(R.id.favorite_title, !TextUtils.isEmpty(item.getTitle()) ? item.getTitle() : "");
        helper.setText(R.id.favorite_popularity, String.valueOf(item.getScancount()));
    }
}
